import { useLocalStorageState } from "ahooks"
import { useDispatch } from "react-redux"
import { changeUserInfo } from "../rtk/reducers/info"



export const userInfoAction = () => {
  const dispatch = useDispatch()
  const [AppToken, setAppToken] = useLocalStorageState<string | undefined>('AppToken')
  const [AppPhone, setAppPhone] = useLocalStorageState<string | undefined>(
    'AppPhone',
  )

  const todoLogout = () => {
    setAppToken('')
    setAppPhone('')
    dispatch(changeUserInfo(null))
  }

  return {
    todoLogout
  }
}
